[Settings] Fix Quick Accent language list being cropped and not reflowing contents#45986
[Settings] Fix Quick Accent language list being cropped and not reflowing contents#45986daverayment wants to merge 2 commits intomicrosoft:mainfrom
Conversation
niels9001
left a comment
There was a problem hiding this comment.
Tested, works great!! Thanks @daverayment !
There was a problem hiding this comment.
Pull request overview
Updates the Quick Accent settings page to make the “Choose character sets” list responsive to window resizing, preventing cropped columns and removing the nested scrollbar behavior.
Changes:
- Adds
LoadedandSizeChangedhandlers on the containingSettingsCardto update the languageListView.MaxWidthbased on the card’s current width/padding. - Removes the
ItemsWrapGrid.MaxWidthbinding that prevented reflow on resize. - Disables the
ListView’s vertical scrolling to avoid nested scrollbars within the page.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml |
Wires up card events, adjusts ListView scrolling behavior, and tweaks wrapping/item sizing for the character set list. |
src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml.cs |
Implements width recalculation logic to keep the ListView constrained to the SettingsCard’s available content width. |
| QuickAccent_Language_Select.MaxWidth = | ||
| card.ActualWidth - card.Padding.Left - card.Padding.Right; |
There was a problem hiding this comment.
card.ActualWidth - card.Padding.Left - card.Padding.Right can go negative (e.g., during initial layout when ActualWidth is 0, or if the card becomes narrower than its padding). FrameworkElement.MaxWidth does not accept negative values and can throw. Clamp the computed value to >= 0 (or at least QuickAccent_Language_Select.MinWidth) before assigning to QuickAccent_Language_Select.MaxWidth.
| QuickAccent_Language_Select.MaxWidth = | |
| card.ActualWidth - card.Padding.Left - card.Padding.Right; | |
| var availableWidth = card.ActualWidth - card.Padding.Left - card.Padding.Right; | |
| var minWidth = QuickAccent_Language_Select.MinWidth; | |
| QuickAccent_Language_Select.MaxWidth = global::System.Math.Max(minWidth, availableWidth); |
There was a problem hiding this comment.
Sure, @niels9001. I will add the defensive check around this to make sure it doesn't go negative.
I'm away atm, but can look at this later today.
…age lists. Add comments. Remove redundant ItemsWrapGrid.ItemWidth.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Summary of the Pull Request
The Character sets list on the Quick Accent settings page had a fixed 3-column layout. This caused two negative user experience issues that this PR solves:
PR Checklist
Detailed Description of the Pull Request / Additional comments
I believe the root cause is that the
ItemsWrapGridis contained within theListView's built-inScrollViewerwhich was able to expand infinitely horizontally. During initial layout, theMaxWidthbinding to the parentSettingsGroup'sActualWidthwas respected and the layout clamped the measurement appropriately, resulting in the correct number of columns. However, on resize the unboundedScrollViewer's infinite horizontal constraint took precedence and the reflow into fewer columns never happened - theScrollViewernever invalidated its children's measure because, from its perspective, their available width (infinite) had not changed. (I think - WinUI's layout and measure cycle melts my brain.)The fix required replacing the
MaxWidthbinding onItemsWrapGridwith aSizeChangedhandler on the parentSettingsCard. The handler reads the parent card's padding (58 pixels left and 44 pixels right) and explicitly sets the language setListView.MaxWidthaccordingly. ALoadedhandler for the card ensures the correct layout on first render.The HorizontalScrollbar that caused the layout issue has been removed.
Screenshots
3-column view:

Resized to 2-columns:

Resized to single-column:

Validation Steps Performed
(All manual tests.)
Verified that: